﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StyleMVVM.Utilities
{
	public static class TaskHelper
	{
		public static Task CreateEmptyTask()
		{
			Task newTask = new Task(() => { });

			newTask.RunSynchronously();

			return newTask;
		}

		public static Task<T> NullTask<T>() where T : class
		{
			Task<T> newTask = new Task<T>(() => null);

			newTask.RunSynchronously();

			return newTask;
		}

		public static Task<T> ReturnTask<T>(T returnValue)
		{
			Task<T> newTask = new Task<T>(() => returnValue);

			newTask.RunSynchronously();

			return newTask;
		}
	}
}